/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#include "stdafx.h"
#include "PBF外力解算.h"




S_PBF外力计算::S_PBF外力计算(S_设备环境& ctx) {
	m_并行计算GPU参数set = 0;

	std::vector<S_着色器创建参数> 参数配置;
	参数配置 = {
		{0, E_着色阶段::e_计算着色, E_板载缓存类型::e_SSBO},
		{1, E_着色阶段::e_计算着色, E_板载缓存类型::e_SSBO},
		{2, E_着色阶段::e_计算着色, E_板载缓存类型::e_SSBO},
		{3, E_着色阶段::e_计算着色, E_板载缓存类型::e_SSBO},
		{4, E_着色阶段::e_计算着色, E_板载缓存类型::e_SSBO},
		{5, E_着色阶段::e_计算着色, E_板载缓存类型::e_SSBO},
		{6, E_着色阶段::e_计算着色, E_板载缓存类型::e_UBO},
	};

	f_gpu_create并行计算实例(ctx, "D:/U/Project/engine/资产/着色/compiled/phy_compiled/外力计算.spv", 参数配置);

	m_Shader->f_alloc参数设置(&(m_并行计算GPU参数set));
}

void S_PBF外力计算::f_updateGPU参数(S_坐标数据* 数据) {
	m_参数元素 = (S_板载缓存**)calloc(6, sizeof(S_板载缓存*));
	m_参数数量 = 6;

	m_参数元素[0] = 数据->m_坐标;
	m_参数元素[1] = 数据->m_速度;
	m_参数元素[2] = 数据->m_块量;
	m_参数元素[3] = 数据->m_坐标_Old;
	m_参数元素[4] = 数据->m_邻接;
	m_参数元素[5] = 数据->m_外力数据->m_方向力;

	m_参数元素[6] = 数据->m_属性;

	//f_setGPU参数布局(m_Shader, m_并行计算GPU参数set, { m_参数元素, 0, m_参数数量, 0 });
}

void S_PBF外力计算::f_step() {
	
}







